package Java7_Concurrency_Cookbook.thread_executor_framework.rejected_execution_handler;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author lixiangke
 * @date 2017/11/21
 */
public class RejectedTaskController implements RejectedExecutionHandler {

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        System.out.printf("RejectedTaskController: The task %s has been rejected\n", r.toString());
        System.out.printf("RejectedTaskController: %s\n", executor.toString());
        System.out.printf("RejectedTaskController: Terminating: %s \n", executor.isTerminating());
        System.out.printf("RejectedTaskController: Terminated %s \n", executor.isTerminated());
    }
}
